功能函数:
[cpp] view plaincopy
-(bool)checkDevice:(NSString*)name
{
NSString* deviceType = [UIDevice currentDevice].model;
NSLog(@"deviceType = %@", deviceType);
NSRange range = [deviceType rangeOfString:name];
return range.location != NSNotFound;
}
调用:
[cpp] view plaincopy
NSString * nsStrIphone=@"iPhone";
NSString * nsStrIpod=@"iPod";
NSString * nsStrIpad=@"iPad";
bool bIsiPhone=false;
bool bIsiPod=false;
bool bIsiPad=false;
bIsiPhone=[self checkDevice:nsStrIphone];
bIsiPod=[self checkDevice:nsStrIpod];
bIsiPad=[self checkDevice:nsStrIpad];
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。